<?php  if ( ! defined('BASEPATH')) exit('No direct script access allowed');
include_once( BASEPATH . '/helpers/date_helper'.EXT);
/**
 * CodeIgniter
 *
 * An open source application development framework for PHP 4.3.2 or newer
 *
 * @package		CodeIgniter
 * @author		ExpressionEngine Dev Team
 * @copyright	Copyright (c) 2008, EllisLab, Inc.
 * @license		http://codeigniter.com/user_guide/license.html
 * @link		http://codeigniter.com
 * @since		Version 1.0
 * @filesource
 */

// ------------------------------------------------------------------------

/**
 * CodeIgniter Date Helpers
 *
 * @package		CodeIgniter
 * @subpackage	Helpers
 * @category	Helpers
 * @author		ExpressionEngine Dev Team
 * @link		http://codeigniter.com/user_guide/helpers/date_helper.html
 */

// ------------------------------------------------------------------------

/**
 * Get "get year data" time
 *
 * Returns array or its GMT equivalent based on the config file preference
 *
 * @access	public
 * @return	integer
 */	
if ( ! function_exists('get_year_data'))
{
	function get_year_data($format="")
	{
		$CI =& get_instance();
		$system_time = "";
		$return_data = array();
		
		switch($format)
		{
			case 'n':
				$date_format = 'n';
			break;
			
			case 'm':
			default:
				$date_format = 'm';
			break;
		}

		if (strtolower($CI->config->item('time_reference')) == 'gmt')
		{
			$now = time();
			$system_time = mktime(gmdate("H", $now), gmdate("i", $now), gmdate("s", $now), gmdate("m", $now), gmdate("d", $now), gmdate("Y", $now));
	
			if (strlen($system_time) < 10)
			{
				$system_time = time();				
			}	
			
		}
		else
		{
			$system_time = time();
		}

		$month_arr = array();
		for($i = 0 ; $i <= 11 ; $i++)
		{
			$month_arr[] = date('m', strtotime("-".$i." month", mktime( 12, 0, 0, date("m", $system_time), 15, date("Y", $system_time) ) ))	;
		}
		$return_data = array_reverse($month_arr);
		return $return_data;
	}
}

//END of File
?>